/**
 *
 */
package net.jadoth.lang.signalthrows;

/**
 * @author Thomas Muenz
 *
 */
public abstract class BranchingThrow extends Throwable
{
	///////////////////////////////////////////////////////////////////////////
	// constants        //
	/////////////////////

	private static final long serialVersionUID = -2235287974282924970L;

	public static final ThrowBreak    BREAK    = new ThrowBreak();
	public static final ThrowContinue CONTINUE = new ThrowContinue();
	public static final ThrowReturn   RETURN   = new ThrowReturn();



	///////////////////////////////////////////////////////////////////////////
	// instance fields  //
	/////////////////////


	private final Object hint;



	///////////////////////////////////////////////////////////////////////////
	// constructors     //
	/////////////////////

	protected BranchingThrow()
	{
		super();
		this.hint = null;
	}

	protected BranchingThrow(final Throwable cause)
	{
		super(cause);
		this.hint = null;
	}

	protected BranchingThrow(final Object hint)
	{
		super();
		this.hint = hint;
	}

	protected BranchingThrow(final Object hint, final Throwable cause)
	{
		super(cause);
		this.hint = hint;
	}



	///////////////////////////////////////////////////////////////////////////
	// getters          //
	/////////////////////

	public Object getHint()
	{
		return this.hint;
	}



	///////////////////////////////////////////////////////////////////////////
	// override methods //
	/////////////////////

	/**
	 * @return
	 * @see java.lang.Throwable#fillInStackTrace()
	 */
	@Override
	public synchronized BranchingThrow fillInStackTrace()
	{
		return this;
	}


}
